package net.zjitc.security.auth;

import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;

@Data
public class MyGrantedAuthority implements GrantedAuthority {

    private String pid;

    public MyGrantedAuthority(String pid) {
        this.pid = pid;
    }

    @Override
    public String getAuthority() {
        return this.pid;
    }
    //比较两个对象是否相同
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        } else {
            return obj instanceof MyGrantedAuthority ? this.pid.equals(((MyGrantedAuthority)obj).getPid()) : false;
        }
    }

}
